package com.nbsaas.boot.product.rest.resource;

import com.nbsaas.boot.product.api.apis.ProductSpecificationApi;
import com.nbsaas.boot.product.data.entity.ProductSpecification;
import com.nbsaas.boot.product.api.domain.request.ProductSpecificationRequest;
import com.nbsaas.boot.product.api.domain.response.ProductSpecificationResponse;
import com.nbsaas.boot.product.api.domain.simple.ProductSpecificationSimple;
import com.nbsaas.boot.product.rest.convert.ProductSpecificationSimpleConvert;
import com.nbsaas.boot.product.rest.convert.ProductSpecificationEntityConvert;
import com.nbsaas.boot.product.rest.convert.ProductSpecificationResponseConvert;
import com.nbsaas.boot.product.data.repository.ProductSpecificationRepository;

import java.io.Serializable;
import com.nbsaas.boot.jpa.data.core.BaseResource;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import jakarta.annotation.Resource;
import org.springframework.data.jpa.repository.support.JpaRepositoryImplementation;

import java.util.function.Function;
/**
*   商品规格-业务接口实现
*/
@Transactional
@Service
public class ProductSpecificationResource extends BaseResource<ProductSpecification,ProductSpecificationResponse, ProductSpecificationSimple, ProductSpecificationRequest>  implements ProductSpecificationApi {

    @Resource
    private ProductSpecificationRepository productSpecificationRepository;

    @Override
    public JpaRepositoryImplementation<ProductSpecification, Serializable> getJpaRepository() {
        return productSpecificationRepository;
    }

    @Override
    public Function<ProductSpecification, ProductSpecificationSimple> getConvertSimple() {
        return new ProductSpecificationSimpleConvert();
    }

    @Override
    public Function<ProductSpecificationRequest, ProductSpecification> getConvertForm() {
        return new ProductSpecificationEntityConvert();
    }

    @Override
    public Function<ProductSpecification, ProductSpecificationResponse> getConvertResponse() {
        return new ProductSpecificationResponseConvert();
    }




}


